package com.encryption.rpc.model
{
	import com.encryption.util.DateFormatUtil;
	import com.encryption.util.FileUtils;

	[RemoteClass(alias="com.encryption.model.File")]
	public class File
	{
		public var id:int;
		public var department:int;
		public var user:int;
		public var fileLevel:int;
		public var fileCategory:int;
		public var name:String;
		public var type:String;
		public var uploadTime:Date;
		public var tag:String;
		public var size:int;
		public var swfUrl:String;
		public var fileUrl:String;
		public var encryptionUrl:String;
		
		public var canView:Boolean = false;
		public var canDownload:Boolean = false;
		public var canPrint:Boolean = false;
		public var canDelete:Boolean = false;
		
		public var userObject:User;
		public var departObj:Department;
		
		public function File()
		{
		}
		
		public function get formatSize():String
		{
			return FileUtils.formatFileSize(size);
		}
		
		public function get formatUploadTime():String
		{
			return DateFormatUtil.commonFormat(uploadTime);
		}
		
		public function get userName():String
		{
			return userObject != null ? userObject.toString() : "";
		}
		
		public function get departName():String
		{
			return departObj != null ? departObj.toString() : "";
		}
	}
}